#ifndef CLIENT_CHOOSE_CAR_H
#define CLIENT_CHOOSE_CAR_H
#include "baseptc.h"
namespace protocal{
class ClientChooseCar : public BasePtc
{
 public:
  ClientChooseCar()
  {
      this->source = CLIENT;
      this->command.cli_command = CLI_CHOOSE_CAR;
      this->size = sizeof(ClientChooseCar);
  };
 public:
  char userID[10];
  char carID[10];
  
public:
  int recv(int sock)
  {
      char buff[size];
      unsigned int recvsize = 0;
      unsigned int ret = 0;
      while(recvsize < this->size - sizeof(BasePtc))
      {
          ret = read(sock,buff+ sizeof(BasePtc) + recvsize,size);
          recvsize += ret;
      }
      ClientChooseCar * tmp = (ClientChooseCar *)buff;
      memcpy(this->userID,tmp->userID,sizeof(this->userID));
      memcpy(this->carID,tmp->carID,sizeof(this->carID));
       return recvsize;
  };
  int send(int sock)
   {
        return write(sock,this,sizeof(ClientChooseCar));
   };
  
};
}

#endif //CLIENT_CHOOSE_CAR_H
